package com.futures.investm.adapter;

import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.futures.investm.R;
import com.futures.investm.entity.ForeignEntity;
import com.futures.investm.utils.IntentUtils;

import java.util.ArrayList;

/**
 * 实时
 */
public class ForeignAdapter extends BaseQuickAdapter<ForeignEntity, BaseViewHolder> {

    public ForeignAdapter() {
        super(R.layout.item_flash_news, new ArrayList<ForeignEntity>());
    }

    @Override
    protected void convert(BaseViewHolder helper, final ForeignEntity item) {

        helper.setText(R.id.tv_time, item.getPublished_time());
        helper.setText(R.id.tv_title, item.getPost_title());

        ImageView view = helper.getView(R.id.img_news);
        Glide.with(mContext).load(item.getMore()).into(view);


        helper.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                IntentUtils.goNewsFlash(mContext,item.getPost_title(),item.getPublished_time(),item.getPost_content(),item.getMore(),"1");
            }
        });

    }
}
